<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>addCaseDetailPage</title>
    <style>
        table{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;margin: auto}
        th,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
        th{font-weight:bold;}
        body{text-align: center}
    </style>
    {% load static %}
    <script type='text/javascript' src="/static/js/jquery.min.js"></script>
    <script type='text/javascript' src="/static/js/user.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("input[name='submit']").click(function(){
                var text = $("#caseContent").val();
                var caseId = $("#caseId").val();
                var crf = $("input[name='csrfmiddlewaretoken']").val();
                var caseDetailName = $("input[name='caseDetailName']").val();
                if(text=='' || caseDetailName==''){
                    alert('请输入内容');
                    return false;
                }
                $.ajax({
                    url:'/addCaseDetail/',
                    type:'POST',
                    data:{caseContent:text,caseId:caseId,caseDetailName:caseDetailName,csrfmiddlewaretoken:crf},
                    success:function(data){
                        if(data=='1'){
                            alert('添加成功');
                            window.location.href="/addCaseTitlePage/"
                        }else{
                            alert('添加失败');
                            location.reload();
                        }
                    }
                });
            });
        });
    </script>
</head>
<body>
<div style="width: 80%;height:40px;background-color: aqua;margin: 0 auto ">
    <div style="float:left;margin-left: 10px;margin-top: 10px"><a href="#" name="projectManager">项目管理&nbsp;&nbsp;</a>|</div>
    <div style="float:left;margin-left: 10px;margin-top: 10px"><a href="#" name="testCaseManager">测试用例管理&nbsp;&nbsp;</a>|</div>
    <div style="float:left;margin-left: 10px;margin-top: 10px"><a href="#" name="bugCheck">bug情况查看&nbsp;&nbsp;</a>|</div>
    <div style="float:left;margin-left: 10px;margin-top: 10px"><a href="#" name="registerPage">注册新用户</a></div>
    <div style="float:right;margin-right:10px;margin-top: 10px"><a href="#" name="logout">退出</a></div>
    <div style="float:right;margin-right:10px;margin-top: 10px">登录人：{{ request.session.showName }}&nbsp;&nbsp;</div>
    <form method="post" name="dataForm">
        {% csrf_token %}
        <input type="hidden" name="dataInput" />
    </form>
</div><p></p>
<table>
    <tr>
        <td width="100px" style="text-align: left">case title</td>
        <td width="200px" style="text-align: left">
            {{ caseInfo.caseTitle }}
            <input type="hidden" value="{{ caseInfo.id }}" name="caseId" id="caseId"/>
        </td>
    </tr>
    <tr>
        <td style="text-align: left">case detail name</td>
        <td style="text-align: left"><input name="caseDetailName" style="width:300px"/><font color="red">*</font></td>
    </tr>
    <tr>
        <td width="150px" style="text-align: left">请输入case内容</td>
        <td>
            <textarea rows="50" cols="110" name="caseContent" id="caseContent"></textarea>
        </td>
    </tr>
    <tr>
        <td colspan="2"><input type="button" name="submit" value="提交"/></td>
    </tr>
</table>
 {% csrf_token %}
</body>
</html>